package Base.基本的三种创建方法;

/**
 * @author 陈鹏
 */
public class ThreadTest {
    public static void main(String[] args) {
        new TicketWindow().start();
        new TicketWindow().start();
        new TicketWindow().start();
        new TicketWindow().start();
    }
}

class TicketWindow extends Thread{
    private int tickets=100;
    @Override
    public void run(){
        while (true){
            if (tickets>0){
                System.out.println(Thread.currentThread().getName()+"正在发售第"+tickets--+"张票");
            }
        }
    }
}
